import { defineConfig } from 'vite'
import createVuePlugin  from "@vitejs/plugin-vue2";

export default defineConfig({
  root: './',
  publicDir: 'public',
  base: './',
  mode: 'development',
  plugins: [createVuePlugin()],
  resolve: {
    alias: [
      { find: '@', replacement: '/src' },
      { find: '@c', replacement: '/src/components' },
      { find: /^~/, replacement: '' }
    ]
  },
  build: {
    rollupOptions: {
      output: {
        manualChunks(id) {
          if (id.includes('node_modules')) {
            return id.toString().split('node_modules/')[1].split('/')[0].toString()
          }
        }
      }
    }
  },
  server: {
    host: 'localhost',
    open: false,
    port: '8080'
  },
})